<template>
    <el-dialog v-model="isShowDelete" title="Tips" width="500">
        <span>确定要删除该条收支记录吗？</span>
        <template #footer>
            <div class="dialog-footer">
                <el-button @click="isShowDelete = false">取消</el-button>
                <el-button type="primary" @click="deleteItem">
                    确认
                </el-button>
            </div>
        </template>
    </el-dialog>
</template>

<script setup lang="ts">
import { deleteExpense } from '@/api/expense';
import { deleteIncome } from '@/api/income';

let isShowDelete = defineModel<Boolean>('isShowDelete',{required:true})
const emit = defineEmits(['delete'])
const props = defineProps({
    budgetId:{
        type:Number,
        required:true
    },
    budgetType:{
        type:Number,
        required:true
    }
}) 
const deleteItem = async()=>{
    if(props.budgetType===0){
        console.log(props)
        await deleteIncome(props.budgetId)
    }else {
        await deleteExpense(props.budgetId)
    }
    emit('delete')
    isShowDelete.value = false
}
</script>

<style scoped>

</style>